import { useAxios } from '@/hooks/web/useAxios'

const request = useAxios()

// 【查詢】員工列表
export const getStaff = (data) => {
  return request.post({
    url: 'user/user/query',
    data
  })
}

// 【新增】新增員工
export const registerUser = (data) => {
  return request.post({
    url: 'user/user/registerUser',
    data
  })
}

// 【查詢】根據id查詢員工/admin信息
export const getByIds = (data) => {
  return request.post({
    url: 'user/user/getByIds',
    data,
    headersType: 'application/x-www-form-urlencoded'
  })
}
//查询用户详细信息
export const getUserById = (userId: string) => {
  return request.postXww({
    url: 'user/user/get',
    params: { pkId: userId }
  })
}

// 【保存】保存員工/admin信息
export const updateUser = (data) => {
  return request.post({
    url: 'user/user/updateUser',
    data
  })
}

// 【刪除】刪除員工/admin
export const delUser = (data) => {
  return request.post({
    url: 'user/user/del',
    data,
    headersType: 'application/x-www-form-urlencoded'
  })
}
/**
 *@author lxc
 *@description:修改用户语言
 *@param:
 *@date: 2022-08-11 14:02:43
 **/
export const editUserLang = (data) => {
  return request.postXww({
    url: 'user/user/updateUserLanguage',
    data
  })
}
